;2008-05-20
;Av Benjamin Ingberg och Patrik Johansson
;
;Våran omgjorda Gui funktion till schemerman, behövs för bl.a. utritning av boarden

(load "gui-display.scm")


(define (make-schemerman-gui width height)
  (let ((frame #f)
        (canvas #f)
        (buffer #f)
        (dc #f))
    
    (define (draw-canvas canvas dc)
      (send dc draw-bitmap (get-buffer *gui*) 0 0))
    
    (define my-canvas%
      (class canvas%
        (override on-char)
        (init-field (key-callback #f))
        (define (on-char event)
          (when key-callback
            (key-callback event)))
        (super-instantiate ()))) 
    
    (set! frame (make-object frame% "Schemerman"))
    
    (set! canvas (instantiate my-canvas% ()
                   (parent frame)
                   (paint-callback draw-canvas)
                   (key-callback key-fn)
                   (min-height height)
                   (min-width width)
                   (stretchable-width #f) 
                   (stretchable-height #f)))
    (set! buffer (make-object bitmap% width height #f))
    (set! dc (make-object bitmap-dc% buffer))
    (make-gui frame canvas buffer dc)))